﻿using UnityEngine;
using System.Collections;

public class GM : MonoBehaviour {
	
	public static string first_name = "Pelaaja";
	public static string last_name = "";
	public static string userId = "9999";
	private static string lastGame;
	private static int lastScore;
	public static bool fbIsInit = false;
	
	// Use this for initialization
	void Start () {
//		DontDestroyOnLoad(this);
	}
	
	// Update is called once per frame
	void Update () {
	}
	
	public static string LastGame {
		get { return lastGame; } 
		set { lastGame = value; }
	}
	public static int LastScore {
		get { return lastScore; } 
		set { lastScore = value; }
	}
	
	public static bool SetHighscore() {
	    // If we don't have a highscore or just made a new one, set lastScore to PlayerPrefs.
        if( !PlayerPrefs.HasKey(lastGame) || PlayerPrefs.GetInt(lastGame) < lastScore ) {
			PlayerPrefs.SetInt(lastGame, lastScore);
			return true;
        } 	
		return false;
	}
	
	public static int GetHighscore() {
		if( PlayerPrefs.HasKey(lastGame) )
			return PlayerPrefs.GetInt(lastGame);
		return 0;
	}
}
